﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using WuxiWTO.Mapping;
using WutiWTO.Common;
using System.Data.Linq;

namespace WuxiWTO.Web
{
    /// <summary>
    /// Summary description for checkLogin
    /// </summary>
    public class checkLogin : IHttpHandler
    {
        private string user_name;
        WTODataContext ctx = new WTODataContext();
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            user_name = context.Request.Form["uname"];
            if (!string.IsNullOrEmpty(user_name))
            {
                var user = from c in ctx.supporters where c.supporter_login_name == user_name select c;
                if (user.ToList().Count <= 0)
                {
                    context.Response.Write("N");//该用户不存在
                }
                else
                {
                    context.Response.Write("Y");//该用户不存在
                }
            }
            else
            {
                context.Response.Write("E");

            }
            context.Response.Flush();
            context.Response.End();
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}